home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CICA Windows Explosion!
/
The CICA Windows Explosion! - Disc 2.iso
/
access
/
ddl110.exe
/
MSADDL11.TXT
< prev
next >
Wrap
Text File
|
1993-06-17
|
49KB
|
937 lines
****************************************************************************
----------------------------------------------------------------------------
| IMPORTANT - PLEASE READ
----------------------------------------------------------------------------
|
| You have a royalty-free right to use, modify, reproduce and distribute
| the software found in these sample files provided, however, that: (a)
| you agree that the MS software is PROVIDED "AS IS" WITHOUT
| WARRANTY OF ANY KIND and in no event shall MS be liable for
| any damages whatsoever in connection with your use of the software;
| and (b) the utilities are redististributed solely in conjunction with and
| as part of your software application.
|
| Copyright 1993 Microsoft Corporation. All Rights Reserved.
| Microsoft and MS-DOS are registered trademarks and Microsoft Access and
| Windows are trademarks of Microsoft Corporation.
****************************************************************************
OVERVIEW
--------
The Microsoft Access Data Definition Language Dynamic Link Library
(MSADDL11.DLL) provides data definition support beyond that provided by
standard Microsoft Access.
GOALS
-----
To enable the Access Basic programmer to create and alter tables, fields,
indexes, and relationships, and then use those tables in Microsoft Access
and Access Basic.
CAUTIONS
--------
This Utility is provided specifically as an aid to developers who need
additional data definition information not provided in the Microsoft
Access retail documentation. As with any DLL, passing an incorrect
argument type or value could result in General Protection Fault (GPF)
errors. If this happens, carefully check your arguments. This Utility
includes an include file (MSA_DDL.TXT) that you can use to declare these
functions. This Utility is not supported by Microsoft; as such, you
should save your work-in-progress frequently to avoid loss of data.
****************************************************************************
DESCRIPTION OF THE DATA DEFINITION DDL
--------------------------------------
The Data Definition interface is a Dynamic Link Library (DLL) you can
call from Access Basic. Its purpose is to allow Access Basic programmers
to programatically manipulate table definitions and data relationships.
For example, this DLL lets you create tables via Access Basic code.
(Note: You can use these functions only with Microsoft Access databases
and tables, and not with any other databases or tables.)
Table 1 lists the functions provided by MSADDL11.DLL. Each function is
fully described later in this document.
Table 1. MSADDL11.DLL Functions
----------------------------------------------------------------------
Function Name Purpose
------------------------- --------------------------------------------
AccessDDLStartEngine Initializes Microsoft Access database engine
AccessDDLStopEngine Stops the database engine
AccessDDLOpenDatabase Opens a specified Microsoft Access database
AccessDDLCloseDatabase Closes the database
AccessDDLOpenTable Opens an existing table
AccessDDLCloseTable Closes an open table
AccessDDLCreateTable Creates a new table
AccessDDLDeleteTable Deletes an existing table
AccessDDLRenameTable Renames an existing table
AccessDDLAddField Adds a new field to a table
AccessDDLDeleteField Deletes an existing field
AccessDDLRenameField Renames an existing field
AccessDDLCreateIndex Creates a new index in an existing table
AccessDDLDeleteIndex Deletes an existing index
AccessDDLRenameIndex Renames an existing index
AccessDDLCreateReference Creates a new relationship between tables
AccessDDLDeleteReference Deletes an existing relationship
****************************************************************************
GENERAL DDL PROCEDURE
---------------------
Before you can create, alter, or delete a table, field, index, or
relationship, you must first use the AccessDDLStartEngine function to
initialize the Microsoft Access ISAM database engine. When you are
finished with all DDL operations, use the AccessDDLStopEngine function.
The following figure illustrates this general procedure.
Figure 1. General DDL Procedure
----------------------------------------------------------------------
AccessDDLStartEngine
AccessDDLOpenDatabase
AccessDDLOpenTable
' Perform field, index, and relationship operations.
AccessDDLCloseTable
AccessDDLCreateTable
' Perform field, index, and relationship operations.
AccessDDLCloseTable
AccessDDLCloseDatabase
AccessDDLStopEngine
****************************************************************************
OTHER CONSIDERATIONS
--------------------
The various functions in MSADDL11.DLL don't let you set all of the
properties normally available in MS Access table design (such as
Description and Validation Rule). To set or change these properties, you
must use the regular table design feature of Microsoft Access.
****************************************************************************
FUNCTION DESCRIPTIONS
---------------------
AccessDDLStartEngine Function
Description Performs the initialization required to use the Microsoft
Access ISAM database engine.
Syntax AccessDDLStartEngine(SysDBName, INIFileName, UserName,
Password)
Remarks The AccessDDLStartEngine function uses the following
arguments.
Argument Description
-------------- ------------------------------------------
SysDBName String that identifies the path and name
of the system database file; must be a
valid operating system path; this argument
is ignored when AccessDDLStartEngine is
called from Access Basic, since the path
and name have already been established.
INIFileName String that identifies the path and name
of the INI file; length may not exceed 14
characters; this argument is ignored when
AccessDDLStartEngine is called from Access
Basic, since the path and name have
already been established.
UserName String that is that name of the current
user.
Password String that is the current user's
password.
Returns
----------------------------------------------------------------------
ACCESSDDL_ErrSuccess Operation was successful.
ACCESSDDL_ErrAccessDenied Current user doesn't have required
permissions.
ACCESSDDL_ErrAlreadyInitialized AccessDDLStartEngine already called.
ACCESSDDL_ErrInvalidAccountName Couldn't find account name.
ACCESSDDL_ErrInvalidParameter One or more parameters is invalid or
Null.
ACCESSDDL_ErrInvalidPassword Incorrect or invalid password.
ACCESSDDL_ErrPermissionDenied Invalid DatabaseID argument.
ACCESSDDL_ErrTooManyTasks Too many concurrent DDL instances.
AccessDDLStopEngine Function
Description Stops the Microsoft Access ISAM database engine and
closes the current session.
Syntax AccessDDLStopEngine()
Remarks The AccessDDLStopEngine function accepts no arguments.
Returns
----------------------------------------------------------------------
ACCESSDDL_ErrSuccess Operation was successful.
ACCESSDDL_ErrNotInitialized AccessDDLStartEngine hasn't been
called.
AccessDDLOpenDatabase Function
Description Opens an existing Microsoft Access database to allow
subsequent DDL operations.
Syntax AccessDDLOpenDatabase(DatabaseName, DatabaseID)
Remarks The AccessDDLOpenDatabase function uses the following
arguments.
Argument Description
-------------- ------------------------------------------
DatabaseName String that is name of the database,
including the path.
DatabaseID Long integer returned by the function that
identifies the database.
Returns
----------------------------------------------------------------------
ACCESSDDL_ErrSuccess Operation was successful.
ACCESSDDL_ErrDatabaseInvalidName Invalid database name.
ACCESSDDL_ErrDatabaseNotFound Couldn't find specified database.
ACCESSDDL_ErrFileAccessDenied Couldn't open the specified database.
ACCESSDDL_ErrInvalidParameter One or more parameters is invalid or
Null.
ACCESSDDL_ErrNotInitialized AccessDDLStartEngine hasn't been
called.
ACCESSDDL_ErrPermissionDenied Database file is read-only.
ACCESSDDL_ErrTooManyOpenFiles No MS-DOS file handle available.
This function may also return various error codes associated with
resource failure.
AccessDDLCloseDatabase Function
Description Closes a database previously opened with the
AccessDDLOpenDatabase function.
Syntax AccessDDLCloseDatabase(DatabaseID)
Remarks The AccessDDLCloseDatabase function uses the following
arguments.
Argument Description
-------------- ------------------------------------------
DatabaseID Long integer that is the ID of the
database to be closed.
Returns
----------------------------------------------------------------------
ACCESSDDL_ErrSuccess Operation was successful.
ACCESSDDL_ErrDatabaseCloseError Couldn't close database file.
ACCESSDDL_ErrDatabaseNotFound Couldn't find database or database
not open.
ACCESSDDL_ErrNotInitialized AccessDDLStartEngine hasn't been
called.
This function may also return various error codes associated with
resource failure.
AccessDDLOpenTable Function
Description Opens an existing Microsoft Access table to allow
subsequent DDL operations.
Syntax AccessDDLOpenTable(DatabaseID, TableName, TableID);
Remarks The AccessDDLOpenTable function uses the following
arguments.
Argument Description
-------------- ------------------------------------------
DatabaseID Long integer that identifies the database
that contains the table to be opened.
TableName String that is the name of the table to be
opened.
TableID Long integer returned by the function that
identifies the opened table.
AccessDDLOpenTable opens the specified table exclusively.
When you are finished with all DDL operations on the
table, use the AccessDDLCloseTable function to close the
table.
Returns
----------------------------------------------------------------------
ACCESSDDL_ErrSuccess Operation was successful.
ACCESSDDL_ErrFileAccessDenied Current user doesn't have required
permissions.
ACCESSDDL_ErrInvalidDatabaseID No such database or database not
open.
ACCESSDDL_ErrInvalidName Invalid table name.
ACCESSDDL_ErrInvalidParameter One or more parameters is invalid or
Null.
ACCESSDDL_ErrNotInitialized AccessDDLStartEngine hasn't been
called.
ACCESSDDL_ErrObjectNotFound Couldn't find specified table.
ACCESSDDL_ErrTableInUse Couldn't open table exclusively.
This function may also return various error codes associated with
resource failure.
AccessDDLCloseTable Function
Description Closes a table previously opened with the
AccessDDLOpenTable or AccessDDLCreateTable functions.
Syntax AccessDDLCloseTable(TableID)
Remarks The AccessDDLCloseTable function uses the following
arguments.
Argument Description
-------------- ------------------------------------------
TableID Long integer that identifies the table to
be closed; this is the value returned by
AccessDDLOpenTable when the table was
opened.
Once closed, the table's TableID will be invalid.
Returns
----------------------------------------------------------------------
ACCESSDDL_ErrSuccess Operation was successful.
ACCESSDDL_ErrInvalidTableID Invalid TableID.
ACCESSDDL_ErrNotInitialized AccessDDLStartEngine hasn't been
called.
AccessDDLCreateTable Function
Description Creates a new table in the specified database.
Syntax AccessDDLCreateTable(DatabaseID, TableName, TableID)
Remarks The AccessDDLCreateTable function uses the following
arguments.
Argument Description
-------------- ------------------------------------------
DatabaseID Long integer that identifies the database
in which the new table will be created.
TableName String that is the name of the table to be
created; may not exceed 64 characters.
TableID Long integer returned by the function that
identifies the exclusively opened table.
The new table will be opened exclusively.
The table will have no fields and no indexes. Use the
AccessDDLAddField function to add fields and
AccessDDLCreateIndex to add indexes. It is inadvisable
to create a table without also defining fields for that
table.
You must use the AccessDDLCloseTable function
to close the table when you are finished with it.
Returns
----------------------------------------------------------------------
ACCESSDDL_ErrSuccess Operation was successful.
ACCESSDDL_ErrAccessDenied Current user doesn't have required
permissions.
ACCESSDDL_ErrInvalidDatabaseID Invalid DatabaseID argument.
ACCESSDDL_ErrInvalidName Invalid table name.
ACCESSDDL_ErrInvalidParameter One or more parameters is invalid or
Null.
ACCESSDDL_ErrNotInitialized AccessDDLStartEngine hasn't been
called.
ACCESSDDL_ErrTableDuplicate Table already exists.
This function may also return various error codes associated with
resource failure.
AccessDDLDeleteTable Function
Description Deletes a specified table, its data, and any indexes.
Syntax AccessDDLDeleteTable(DatabaseID, TableName)
Remarks The AccessDDLDeleteTable function uses the following
arguments.
Argument Description
-------------- ------------------------------------------
DatabaseID Long integer that identifies the database
that contains the table.
TableName String that is the name of the table to be
deleted; may not exceed 64 characters.
The table must not be open by any user, including the
current user.
The current user must have Modify Definitions permission
for the specified table.
Once deleted, all queries, forms, reports, or code that
reference the table will be invalid.
IMPORTANT When you use AccessDDLDeleteTable to delete a table that
was created or modified in MS Access table design (as
opposed to created or modified using MSADDL11.DLL), MS
Access maintains internal information about the table
which will remain in the database until the database is
compacted. Until this information is discarded, you will
encounter unpredictable results if you use the
AccessDDLCreateTable function to create another table
with the same name, or use the AccessDDLRenameTable
function to rename an existing table to the same name
without first compacting the database.
Returns
----------------------------------------------------------------------
ACCESSDDL_ErrSuccess Operation was successful.
ACCESSDDL_ErrAccessDenied Current user doesn't have required
permissions.
ACCESSDDL_ErrIndexInUse Table contains an index that exists
in a reference (relationship) and
can't be deleted.
ACCESSDDL_ErrInvalidDatabaseID Invalid DatabaseID argument.
ACCESSDDL_ErrInvalidName Invalid table name.
ACCESSDDL_ErrInvalidParameter One or more parameters is invalid or
Null.
ACCESSDDL_ErrNotInitialized AccessDDLStartEngine hasn't been
called.
ACCESSDDL_ErrObjectNotFound No such table.
ACCESSDDL_ErrTableInUse Table is in use by another user.
AccessDDLRenameTable Function
Description Renames a specified table.
Syntax AccessDDLRenameTable(DatabaseID, OldTableName,
NewTableName)
Remarks The AccessDDLRenameTable function uses the following
arguments.
Argument Description
-------------- ------------------------------------------
DatabaseID Long integer that identifies the database
that contains the table.
OldTableName String that is the table to be renamed;
may not exceed 64 characters.
NewTableName String that is the new table name; may not
exceed 64 characters.
You can freely rename tables created with MSADDL11.DLL;
however, when you rename a table that was created in MS
Access table design (as opposed to created using the DLL),
Access will maintain outdated internal information about the
old table name which will remain in the database until the
database is compacted. Until this information is discarded,
you will encounter unpredictable results if you use the
AccessDDLCreateTable or AccessDDLRenameTable functions to
create or rename another table with the old table name.
Also note that any properties defined in table design will
be lost if the table is renamed using AcccessDDLRenameTable.
The table must be closed in order to be renamed.
Once renamed, all queries, forms, reports, or code that
reference the old table name will be invalid.
The current user must have Modify Definitions permission
for the table.
Returns
----------------------------------------------------------------------
ACCESSDDL_ErrSuccess Operation was successful.
ACCESSDDL_ErrAccessDenied Current user doesn't have required
permissions.
ACCESSDDL_ErrInvalidDatabaseID Invalid DatabaseID argument.
ACCESSDDL_ErrInvalidName Invalid table name.
ACCESSDDL_ErrInvalidParameter One or more parameters is invalid or
Null.
ACCESSDDL_ErrNotInitialized AccessDDLStartEngine hasn't been
called.
ACCESSDDL_ErrObjectNotFound Couldn't find specified table.
ACCESSDDL_ErrTableDuplicate New table name already exists.
ACCESSDDL_ErrTableInUse Table is in use by another user.
AccessDDLAddField Function
Description Adds a new field to a specified table.
Syntax AccessDDLAddField(DatabaseID, TableID, FieldName,
FieldType, Max, AutoIncr)
Remarks The AccessDDLAddField function uses the following
arguments.
Argument Description
-------------- ------------------------------------------
DatabaseID Long integer that identifies the database
that contains the table to which the new
field will be added.
TableId Long integer that identifies the table;
this is the value returned by
AccessDDLOpenTable when the table was
opened.
FieldName String that is the name of the new field;
may not exceed 64 characters.
FieldType Integer that identifies the field type;
valid FieldType values are:
ACCESSDDL_FIELDTYPEYESNO yes/no
ACCESSDDL_FIELDTYPEBYTE byte
ACCESSDDL_FIELDTYPEINTEGER integer
ACCESSDDL_FIELDTYPELONGINTEGER long integer
ACCESSDDL_FIELDTYPECURRENCY currency
ACCESSDDL_FIELDTYPESINGLE single
ACCESSDDL_FIELDTYPEDOUBLE double
ACCESSDDL_FIELDTYPEDATETIME date/time
ACCESSDDL_FIELDTYPETEXT text
ACCESSDDL_FIELDTYPEOLE OLE object
ACCESSDDL_FIELDTYPEMEMO memo
Max Long integer that is the maximum length of
a text field.
AutoIncr Integer that specifies whether the
field is an autoincrement field; valid
AutoIncr values are:
-1 A unique ascending sequence
number will be automatically
assigned to the field when a new
record is added to the table.
FieldType must be a long integer.
0 No such number will be assigned.
If FieldType identifies a numeric field type, the field's
width will be fixed. All other field types will render a
variable-width field.
The current user must have Modify Definitions permission
for the table.
Tables can each contain up to 256 fields.
Returns
----------------------------------------------------------------------
ACCESSDDL_ErrSuccess Operation was successful.
ACCESSDDL_ErrAccessDenied Current user doesn't have required
permissions.
ACCESSDDL_ErrField2ndSysMaint More than one autoincrement field
has been defined.
ACCESSDDL_ErrFieldDuplicate Field definition already exists.
ACCESSDDL_ErrFieldTooBig Text field width exceeds 255
characters.
ACCESSDDL_ErrInvalidFieldType Invalid FieldType argument.
ACCESSDDL_ErrInvalidDatabaseID Invalid DatabaseID argument.
ACCESSDDL_ErrInvalidName Invalid FieldName argument.
ACCESSDDL_ErrInvalidParameter One or more parameters is invalid or
Null.
ACCESSDDL_ErrInvalidTableID Invalid TableID argument.
ACCESSDDL_ErrNotInitialized AccessDDLStartEngine hasn't been
called.
ACCESSDDL_ErrTooManyFields More than 256 fields defined.
AccessDDLDeleteField Function
Description Deletes a specified field from a specified
table.
Syntax AccessDDLDeleteField(TableID, FieldName)
Remarks The AccessDDLDeleteField function uses the following
arguments.
Argument Description
-------------- ------------------------------------------
TableID Long integer that identifies the
exclusively opened table; this is the
value returned by AccessDDLOpenTable when
the table was opened.
FieldName String that is the name of the field to
be deleted; may not exceed 64 characters.
You can't delete a field if the table contains an index
based on that field. To delete the field, you must first
use the AccessDDLDeleteIndex function to delete the
index.
You also can't delete a field if there is a relationship
based on that field. To delete the field, the relationship
must first be deleted using AccessDDLDeleteReference.
The current user must have both Modify Definitions and
Read Data permissions for the table.
If the field width is fixed (for example, a text field),
the space for the field in existing records won't always
be recovered. New records will contain space for the
deleted field.
If the field width is variable (for example, a memo
field), any data in existing records is not deleted and
no space is recovered. New records will contain a single
byte for the deleted field.
To recover the space deleted by AccessDDLDeleteField,
compact the database.
Once deleted, all queries, forms, reports, or code that
reference the deleted field will be invalid.
Returns
----------------------------------------------------------------------
ACCESSDDL_ErrSuccess Operation was successful.
ACCESSDDL_ErrAccessDenied Current user doesn't have required
permissions.
ACCESSDDL_ErrFieldIndexed Can't delete field because index
using this field exists.
ACCESSDDL_ErrFieldNotFound Couldn't find specified field.
ACCESSDDL_ErrInvalidName Invalid field name.
ACCESSDDL_ErrInvalidParameter One or more parameters is invalid or
Null.
ACCESSDDL_ErrInvalidTableID Invalid TableID argument.
ACCESSDDL_ErrNotInitialized AccessDDLStartEngine hasn't been
called.
AccessDDLRenameField Function
Description Renames a specified field.
Syntax AccessDDLRenameField(TableID, OldFieldName, NewFieldName)
Remarks The AccessDDLRenameField function uses the following
arguments.
Argument Description
-------------- ------------------------------------------
TableID Long integer that identifies the table
that contains the field to be renamed;
this is the value returned by
AccessDDLOpenTable when the table was
opened.
OldFieldName String that is the name of an existing
field; may not exceed 64 characters.
NewFieldName String that is the new name; may not
exceed 64 characters.
Once renamed, all queries, forms, reports, or code that
reference the old field name will be invalid.
If you rename a field that was created in table design
(as opposed to created using MSADDL11.DLL), the field
will lose all of its existing properties. You should
then set the various properties in table design.
Returns
----------------------------------------------------------------------
ACCESSDDL_ErrSuccess Operation was successful.
ACCESSDDL_ErrAccessDenied Current user doesn't have required
permissions.
ACCESSDDL_ErrFieldNotFound Couldn't find the specified field.
ACCESSDDL_ErrFieldDuplicate Field name already exists.
ACCESSDDL_ErrInvalidName Invalid field name.
ACCESSDDL_ErrInvalidParameter One or more parameters is invalid or
Null.
ACCESSDDL_ErrInvalidTableID Invalid TableID argument.
ACCESSDDL_ErrNotInitialized AccessDDLStartEngine hasn't been
called.
AccessDDLCreateIndex Function
Description Defines and creates an index in a specified table.
Syntax AccessDDLCreateIndex(TableID, IndexName, IndexFlag, Key)
Remarks The AccessDDLCreateIndex function uses the following
arguments.
Argument Description
-------------- ------------------------------------------
TableID Long integer that identifies the table for
which a new index will be created; this is
the value returned by AccessDDLOpenTable
when the table was opened.
IndexName String that is the name of the index; may
not exceed 64 characters.
Primary Key
-----------
If you are defining the primary key (see
description for the IndexFlag argument,
below), the IndexName must be the string
"PrimaryKey".
Single-Field Index
------------------
The IndexName is the same as the name of
the field.
Multiple-Field Index
--------------------
The IndexName is one of "Index1",
"Index2", and so on, through "Index5".
IndexFlag Long integer as follows:
ACCESSDDL_BitIndexPrimary
If this is to be the primary index.
ACCESSDDL_BitIndexUnique
If duplicate index entries are to be
disallowed.
Key String that is a list of field names, in
order of key significance, delimited with
an exclamation point ("!"); may not exceed
255 characters, nor contain more than 10
field names.
The current user must have both Modify Definitions and
Read Data permissions for the table.
The new index cannot include a Memo field, an OLE object
field, or a Yes/No field.
Indexes exceeding the maximum length will be truncated.
Returns
----------------------------------------------------------------------
ACCESSDDL_ErrSuccess Operation was successful.
ACCESSDDL_ErrAccessDenied Current user doesn't have required
permissions.
ACCESSDDL_ErrFieldCannotIndex At least one of the specified fields
in Key is a Memo or OLE object field.
ACCESSDDL_ErrFieldNotFound Couldn't find specified field name.
ACCESSDDL_ErrIndexDuplicate Index already exists.
ACCESSDDL_ErrIndexHasPrimary Primary index already exists.
ACCESSDDL_ErrInvalidName Invalid index or field name.
ACCESSDDL_ErrInvalidParameter One or more parameters is invalid or
Null.
ACCESSDDL_ErrInvalidTableID Invalid TableID argument.
ACCESSDDL_ErrNotInitialized AccessDDLStartEngine hasn't been
called.
ACCESSDDL_ErrTooManyKeys Too many fields in Key.
AccessDDLDeleteIndex Function
Description Deletes a specified index.
Syntax AccessDDLDeleteIndex(TableID, IndexName)
Remarks The AccessDDLDeleteIndex function uses the following
arguments.
Argument Description
-------------- ------------------------------------------
TableID Long integer that identifies the table
that contains the index to be deleted;
this is the value returned by
AccessDDLOpenTable when the table was
opened.
IndexName String that is the name of the index; may
not exceed 64 characters.
Once deleted, all code that references the deleted index
will be invalid. You cannot delete an index if it is on
the primary (referenced) side of a relationship.
The current user must have Modify Definitions permission
for the table.
Returns
----------------------------------------------------------------------
ACCESSDDL_ErrSuccess Operation was successful.
ACCESSDDL_ErrAccessDenied Current user doesn't have required
permissions.
ACCESSDDL_ErrIndexInUse Specified index exists in a reference
(relationship) and can't be deleted.
ACCESSDDL_ErrIndexNotFound Couldn't find specified index.
ACCESSDDL_ErrInvalidName Invalid index name.
ACCESSDDL_ErrInvalidParameter One or more parameters is invalid or
Null.
ACCESSDDL_ErrInvalidTableID Invalid TableID argument.
ACCESSDDL_ErrNotInitialized AccessDDLStartEngine hasn't been
called.
AccessDDLRenameIndex
Description Renames a specified index.
Syntax AccessDDLRenameIndex(TableID, Index, IndexNew)
Remarks The AccessDDLRenameIndex function uses the following
arguments.
Argument Description
-------------- ------------------------------------------
TableID Long integer that identifies the
exclusively opened table; this is the
value returned by AccessDDLOpenTable when
the table was opened.
OldIndexName String that is the existing name of
the index; may not exceed 64 characters.
NewIndexName String that is the new index name; may not
exceed 64 characters.
Once you rename an index, all code that references the
old index name will be invalid.
The current user must have Modify Definitions permission
for the table.
Returns
----------------------------------------------------------------------
ACCESSDDL_ErrSuccess Operation was successful.
ACCESSDDL_ErrAccessDenied Current user doesn't have required
permissions.
ACCESSDDL_ErrIndexDuplicate Index already exists.
ACCESSDDL_ErrIndexNotFound No such index.
ACCESSDDL_ErrInvalidName Invalid index name specified.
ACCESSDDL_ErrInvalidParameter One or more parameters is invalid or
Null.
ACCESSDDL_ErrInvalidTableID Invalid TableID argument.
ACCESSDDL_ErrNotInitialized AccessDDLStartEngine hasn't been
called.
AccessDDLCreateReference Function
Description Creates a relationship between two specified tables.
Please note: the referenced table is the primary table
(the "one" side of a one-to-many relationship or either
table in a one-to-one relationship). The referencing
table is the related table (the "many" side of a one-to-
many relationship).
Syntax AccessDDLCreateReference(TableID, ReferenceName, Fields,
ReferencedTable, ReferencedFields, MatchFlag)
Remarks The AccessDDLCreateReference function uses the following
arguments.
Argument Description
------------------ --------------------------------------
TableID Long integer that identifies the
referencing table; this is the value
returned by AccessDDLOpenTable when
the table was opened.
ReferenceName String that is the name of the
reference.
Fields String that is a list of field names
delimited with an exclamation point
("!"); the data types of the
referencing fields must match those
of the referenced fields.
ReferencedTable String that is the name of the
referenced table; this table will be
opened exclusively to ensure that the
reference definition is seen by other
sessions; the referenced table may be
the same as the referencing table.
ReferencedFields A string that is a list of field
names delimited with an exclamation
point ("!"); if this argument is Null,
the fields that comprise the
referenced table's primary index are
used; if this argument is non-Null,
the fields must match the order of
the definition of an existing unique
index on the reference table with
attributes that are compatible with
the match type specified by the
MatchFlag argument; the correspondence
between referencing and referenced
fields is by position within the
field list (when specified) or
position within the primary index
definition (when not specified).
MatchFlag Long integer that specifies the match
type and referential triggered
actions; valid MatchFlag values are:
ACCESSDDL_ReferenceUnique
Identifies the relationship as
one to one; if an index is
created, the index will have
the unique attribute.
ACCESSDDL_ReferenceDontEnforce
Allows users to define
relationships that are not
enforced.
You cannot create a relationship with the same
referenced table, referenced fields, referencing table,
and referencing fields.
If the referencing table already has a unique index on
the referencing fields, then a unique reference is
created, even if the MatchFlag argument is not set to
ACCESSDDL_ReferenceUnique.
You cannot create a relationship on Memo or OLE object
fields.
The current user must have Modify Definitions permission
for both the referencing and referenced tables.
Returns
----------------------------------------------------------------------
ACCESSDDL_ErrSuccess Operation was successful.
ACCESSDDL_ErrAccessDenied Current user doesn't have required
permissions.
ACCESSDDL_ErrFieldCannotIndex At least one of the specified fields
is a Memo or OLE object field.
ACCESSDDL_ErrFieldNotFound Couldn't find specified field name.
ACCESSDDL_ErrIndexDuplicate Specified reference already exists.
ACCESSDDL_ErrIndexNotFound Foreign key doesn't match primary
key.
ACCESSDDL_ErrInvalidName Invalid referenced table name.
ACCESSDDL_ErrInvalidParameter One or more parameters is invalid or
Null.
ACCESSDDL_ErrInvalidParameter Number of fields in foreign key
doesn't match number of fields in
primary key.
ACCESSDDL_ErrInvalidTableID Invalid TableID argument.
ACCESSDDL_ErrLinkNotSupported Can't create reference on attached
table.
ACCESSDDL_ErrNotInitialized AccessDDLStartEngine hasn't been
called.
ACCESSDDL_ErrObjectNotFound Table name can't be an empty string.
ACCESSDDL_ErrSelfReference Can't refer to same field when the
referenced and reference tables are
the same.
ACCESSDDL_ErrTableInUse Table is in use by another user.
ACCESSDDL_ErrTooManyKeys Too many referenced fields specified
or too many fields specified in key.
AccessDDLDeleteReference Function
Description Deletes relationships between two specified tables.
Syntax AccessDDLDeleteReference(TableID, ReferenceName)
Remarks The AccessDDLDeleteReference function uses the following
arguments.
Argument Description
-------------- ------------------------------------------
TableID Number that identifies the exclusively
open referencing table; this is the value
returned by AccessDDLOpenTable when the
table was opened.
ReferenceName String that is the name of the reference
you want to delete.
Returns
----------------------------------------------------------------------
ACCESSDDL_ErrSuccess Operation was successful.
ACCESSDDL_ErrAccessDenied Current user doesn't have required
permissions.
ACCESSDDL_ErrIndexNotFound Specified index couldn't be found.
ACCESSDDL_ErrInvalidParameter One or more parameters is invalid or
Null.
ACCESSDDL_ErrNotInitialized AccessDDLStartEngine hasn't been
called.
<end of file>